home *** CD-ROM | disk | FTP | other *** search
- Path: news.internex.net.au!usenet
- From: sultan@connexus.apana.org.au (Jon Hornstein)
- Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.edu,comp.lang.eiffel
- Subject: Re: Hungarian notation
- Date: 2 Jan 1996 16:00:40 GMT
- Organization: Connexus Internet
- Message-ID: <4cbkr9$5h2@preeda.internex.net.au>
- References: <30C40F77.53B5@swsbbs.com> <marnoldDJEvtJ.1Lx@netcom.com> <6sp2wg2yqLwd083yn@iaccess.za>
- NNTP-Posting-Host: dialin-13.connexus.apana.org.au
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.93.11
-
- In article <6sp2wg2yqLwd083yn@iaccess.za>, vincer@iaccess.za says...
- >
- >In article <ou91k2jozn.fsf@i486.mcneil.com>,
- >sean@mcneil.com (Sean McNeil) wrote:
- >
- >This kind of code....
- >
- >> /* if the branches are of the same kind... */
- >> Branch brFirst= abrBranches[ixbrFirst];
- >> Branch brSecond= abrBranches[ixbrSecond];
- >> if (G_brKind(brFirst) == G_brKind(brSecond) &&
- >> /* ...and the same destination... */
- >> G_brDest(brFirst) == G_brDest(brSecond))
- >> {
- >> /* do something useful with the parallel edges */
- >> ...
- >
- >written as
- >
- > Branch Branch1 = Branches[First];
- > Branch Branch2 = Branches[Second];
- > // if the branches are of the same kind...
- > // ...and the same destination...
- > if (KindBranch(Branch1) == KindBranch(Branch2) &&
- > DestBranch(Branch1) == DestBranch(Branch2))
- > {
- > // do something useful with the parallel edges
- > ...
- > }
- >
- >is far more readable, with strong typing there would be warnings
- >if things were used incorrectly.
- >
- >Vince
- >=====
- My experience, in the spirit of hungarian notation, is that it gives
- consistent clues to the type and declaration of a declared variables. I've
- developed a consistent naming convention which includes hungarian notation
- prefixes and and then noun combinations and perhaps a postfix to declare all
- my variables. These variables may be quite large but thats never been a
- consideration when it comes to finding errors.
-
- Branch1 and Branches is too confusing as a token. The information content in
- the name is quite small. I inferred from the name that it has something to
- do with a generic branch. I would not add a generic hungarian prefix to
- infrequently used types as they may cause confusion with the standard set of
- tokens as used to define type.
-
- For example Branch1 could become br1, but thus could infer a boolean real 1
- nonsense! My preference would be FirstBranch with no hungarian prefix!
-
- So instead of
-
- Branch Branch1 = Branches[First];
- Branch Branch2 = Branches[Second];
- ...
-
- I may name it
-
- BRANCH FirstBranch = aBranches[FIRST_E],
- NextBranch = aBranches[SECOND_E];
-
- // if the branches are of the same kind...
- // ...and the same destination...
- if (SameBranchType(FirstBranch) == SameBranchType(NextBranch) &&
- SameBranchDestination(FirstBranch) == SameBranchDestination(NextBranch))
- {
- // do something useful with the parallel edges
- ...
- }
-
-
-